package com.icetech.eom.service.impl.sys;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.icetech.eom.dao.sys.RoleDao;
import com.icetech.eom.domain.sys.Role;
import com.icetech.eom.service.sys.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangzw
 * @since 2018-12-10
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleDao, Role> implements IRoleService {
    @Autowired
    private RoleDao roleDao;
    @Override
    public List<Role> getAllRole() {
        return roleDao.getAll();
    }

    @Override
    public PageInfo<Role> selectByPage(Integer page, Integer pageSize, String searchKey) {
        PageHelper.startPage(page,pageSize);
        List<Role> roles = roleDao.selectBySearchKey(searchKey);
        return new PageInfo(roles);
    }

    @Override
    public List<Role> getDefaultRole() {
        return roleDao.getDefaultRole();
    }
}
